<template>
  <div class="app-container" v-loading="loading">
      <center><h3 style="color:red">我的经验值：{{totalExperienceValue}}</h3></center>
    <p>我的监考记录</p>
    <hr />
    <div v-for="(item) in items" :key="item.id">
      <el-row type="flex" justify="end">
        <el-col :span=24><h4>{{item.active_name}}</h4>
          <p>发布部门：{{item.department_name}}</p>
          <p>报名时间：{{item.signup_date}}
          <p>考试开始时间：{{item.exam_start_date}}</p>
          <p>考试结束时间：{{item.exam_end_date}}</p>
          <p>考务人员类型：{{item.personnel_type}}</p>
          <p>费用标准：{{item.examinationFee}}</p>
          <p>获取经验值：{{item.get_experience_value}}</p>
          <span>完成状态：</span>
          <el-tag size="large" type="success" v-if="item.finish_status === '1'">正常完成</el-tag>
          <el-tag size="large"  v-else-if="item.finish_status === '0'">未考核</el-tag>
          <el-tag size="large" type="danger" v-else>不合格</el-tag>
          <br>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="24"><span><hr></span></el-col>
      </el-row>
    </div>
    <div style="text-align:center" v-if="items.length > 0">已到底线</div>
    <div style="text-align:center" v-else>暂无监考记录</div>
  </div>
</template>

<script>
import { myInvigilateRecords } from '@/api/activePublish'
import { mapGetters } from 'vuex'
import { parseTime } from '@/utils'
export default {
  name: 'queryActive',
  data() {
    return {
      form: {
        active_name: '',
        signup_start_date: '2018-12-01 9:00',
        signup_end_date: '2018-12-01 9:00',
        exam_start_date: '',
        exam_end_date: '',
        personnel_type: '监考',
        remark: '',
        department_code: '',
        numOfPeaple: '',
        examinationFee: '600/天',
        imglist: [{ name: 'ExcelTest.xls', src: '/src/icons/Excel.png' }]
      },
      items: [],
      loading: false,
      signup: '立即报名',
      canSignup: true,
      dialogFormVisible: false,
      dialogForm: { patrol_group_no: '',
        examination_room_no: '',
        classroom: '',
        invigilate_start_time: '',
        invigilate_end_time: '',
        register_time: '',
        train_time: '',
        train_address: ''
      },
      totalExperienceValue: 0,
      isArranged: false
    }
  },
  computed: {
    ...mapGetters([
      'name',
      'roles',
      'teacherTypeCode'
    ])
  },
  mounted: function() {
    const that = this
    that.loading = true
    myInvigilateRecords(that.name).then(response => {
      if (response.exception) {
        that.processing = false
        that.$message.error(response.exception.message)
        return
      }
      const data = response.result
      if (data.length > 0) {
        that.totalExperienceValue = data[0]['TOTALEXPERIENCEVALUE']
      }
      for (let i = 0; i < data.length; i++) {
        that.items.push({ id: data[i]['ID'], active_name: data[i]['ACTIVENAME'],
          signup_date: parseTime(new Date(Date.parse(data[i]['SIGNUPTIME'].replace(/-/g, '/')))),
          signup_end_date: parseTime(new Date(Date.parse(data[i]['SIGNUPENDTIME'].replace(/-/g, '/')))),
          exam_start_date: parseTime(new Date(Date.parse(data[i]['EXAMSTARTTIME'].replace(/-/g, '/')))),
          exam_end_date: parseTime(new Date(Date.parse(data[i]['EXAMENDTIME'].replace(/-/g, '/')))),
          personnel_type: data[i]['PERSONNELTYPENAME'], remark: data[i]['REMARK'],
          examinationFee: data[i]['EXAMINATIONFEE'],
          finish_status: data[i]['FINISHSTATUS'],
          department_name: data[i]['DEPARTMENTNAME'],
          get_experience_value: data[i]['GETEXPERIENCEVALUE']

        })
      }
      that.loading = false
    }).catch(error => {
      console.log(error)
      that.loading = false
      that.$message.error('获取数据失败...')
    })
  },
  methods: {

  }
}
</script>

<style scoped>
.tag{
  text-align: center;
  vertical-align: right
}
.upload_warp_img_div img {
  max-width: 100%;
  max-height: 100%;
  vertical-align: middle;
}
.upload_warp_img_div {
  position: relative;
  height: 100px;
  width: 120px;
  border: 1px solid #ccc;
  margin: 0px 30px 10px 0px;
  float: left;
  line-height: 100px;
  display: table-cell;
  text-align: center;
  background-color: #eee;
  cursor: pointer;
}
.upload_warp_img_div_top {
  position: absolute;
  top: 0;
  width: 100%;
  height: 30px;
  background-color: rgba(0, 0, 0, 0.4);
  line-height: 30px;
  text-align: left;
  color: #fff;
  font-size: 12px;
  text-indent: 4px;
}
.upload_warp_img_div_text {
  white-space: nowrap;
  width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload_warp_img_div_del {
  position: absolute;
  top: 6px;
  width: 16px;
  right: 4px;
}
.upload_warp_img {
  border-top: 0px solid #D2D2D2;
  padding: 14px 0 0 14px;
  overflow: hidden
}
</style>

